if __name__ == '__main__':
    import  CloudXNS_APISDK
    import json
    api=CloudXNS_APISDK.CloudXNS_API(api_key='',secret_key='',debug_log=True)
    j1=json.loads(api.domain_list())
    domain_id=j1["data"][0]["id"]
    j2=api.domain_host_list(domain_id)
    j2_dict=json.loads(j2)
    i=0
    while i<=int(j2_dict["total"])-1:
        print('('+str(i)+') '+'ID:'+j2_dict["hosts"][i]["id"]+':'+j2_dict["hosts"][i]["domain_name"])
        i = i + 1
    print("请输入你想修改的记录")
    Num=int(input("输入数字 >>>"))
    reid=api.domain_host_record_list(domain_id,j2_dict["hosts"][Num]["id"])
    print("正在查询")
    reid_dict=json.loads(reid)
    record_id=int(reid_dict["data"][0]["record_id"])
    print('你选择的主机头:'+reid_dict["data"][0]["host"])
    print('当前解析：'+reid_dict["data"][0]["value"])
    value=input('输入你想修改的IP地址')
    res=api.domain_host_record_update(domain_id, record_id, j2_dict["hosts"][Num]["host"], value, 'AX', )
    res_dict=json.loads(res)
    print('修改完成')
    print('域名：' + res_dict["data"]["domain_name"] + '---' + res_dict["data"]["value"])

